import request from "@/request/api";
/* 设备管理 */
//查询设备台账树形结构
export function deviceTree() {
  return request({
    url: "/eam-service-device/equipment/getTree",
    method: "get",
  });
}
//获取层级数据
export function getFloorApi(data) {
  return request({
    url: "/eam-service-device/equipment/getFloor",
    method: "get",
    params: data,
  });
}
//导出设备
export function exportDevicesApi(data) {
  return request({
    url: "/eam-service-device/equipment/export",
    method: "get",
    params: data,
    responseType: 'blob',
  });
}
//导出台账模板
export function exportModelApi() {
  return request({
    url: "/eam-service-device/equipment/downEquipmentTemplate",
    method: "get",
    responseType: 'blob',
  });
}
//下载导入错误表格
export function exportErrorApi(data) {
  return request({
    url: "/eam-service-device/equipment/errorEqExport",
    method: "get",
    params: data,
    responseType: 'blob',
  });
}
//台账导入
export function uploadParameterApi(data = {}, formdata = new FormData()) {
  return request({
    url: `/eam-service-device/equipment/importEquipment`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    params: data,
    data: formdata,
  });
}
//台账导入
export function uploadBasicParams(data = {}, formdata = new FormData()) {
  return request({
    url: `/eam-service-device/paramimp/importRecord`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    params: data,
    data: formdata,
  });
}
//台账导入
export function uploadTechParams(formdata = new FormData()) {
  return request({
    url: `/eam-service-device/paramimp/importJsParam`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: formdata,
  });
}
//获取某个节点的所有父节点
export function getParentIdsApi(id = "") {
  return request({
    url: "/eam-service-device/equipment/getParentIds",
    method: "get",
    params: {
      id,
    },
  });
}
//根据参数id查询参数
export function getParamByIdApi(paramId = "") {
  return request({
    url: "/eam-service-device/equipment/getParamById",
    method: "get",
    params: {
      paramId
    },
  });
}
//查询设备分类树-懒加载
export function lazyClassifyTree(data) {
  return request({
    url: "/eam-service-device/equipment/getTreeLazy",
    method: "get",
    params: data,
  });
}
//根据设备名称模糊查询
export function queryList(data) {
  return request({
    url: "/eam-service-device/equipment/queryList",
    method: "get",
    params: data
  });
}

//查询设备分类树-全加载
export function deviceClassifyTree() {
  return request({
    url: "/eam-service-device/standard/deviceClassify/tree",
    method: "get",
  });
}

//根据分类id查询参数列表
export function getConfigApi(typeId = "") {
  return request({
    url: "/eam-service-device/equipment/getParamsByTypeId",
    method: "get",
    params: {
      typeId,
    },
  });
}
//删除设备
export function deleteApi(id = "") {
  return request({
    url: "/eam-service-device/equipment/delete",
    method: "get",
    params: {
      id,
    },
  });
}
//查询单个设备
export function getEquipment(id = "") {
  return request({
    url: "/eam-service-device/equipment/getById",
    method: "get",
    params: {
      id,
    },
  });
}
//新增设备
export function insertApi(data) {
  return request({
    url: "/eam-service-device/equipment/insert",
    method: "post",
    data: data,
  });
}
//移动节点
export function moveNode(data) {
  return request({
    url: "/eam-service-device/equipment/moveNode",
    method: "get",
    params: data,
  });
}
//修改设备
export function updateApi(data) {
  return request({
    url: "/eam-service-device/equipment/update",
    method: "post",
    data: data,
  });
}

export function getLeftUpperApi(data) {
  return request({
    url: "/eam-service-device/equipment/getLeftUpperEquipmentByDeptId",
    method: "get",
    params: data,
  });
}
//获取二维码
export function getCodeApi(data) {
  return request({
    url: "/eam-common-web/qrCode/miniProgram/create",
    method: "get",
    params: data,
  });
}
//人工记录
export function getManualRecordApi(data) {
  return request({
    url: "/eam-service-device/equipment/params/queryList",
    method: "get",
    params: data,
  });
}
//获取高压线路
export function getLineTree(data) {
  return request({
    url: "/eam-service-device/equipment/getLineTree",
    method: "get",
    params: data,
  });
}
//设备分类-高级搜索
export function advancedQuery(data) {
  return request({
    url: "/eam-service-device/equipment/advancedQuery",
    method: "get",
    params: data,
  });
}
//设备台账-高级搜索
export function advancedEquipmentQuery(data) {
  return request({
    url: "/eam-service-device/equipment/advancedEquipmentQuery",
    method: "get",
    params: data,
  });
}
//查询设备台账
export function getEquipmentByParentId(data) {
  return request({
    url: "/eam-service-device/equipment/getEquipmentByParentId",
    method: "get",
    params: data,
  });
}
// 查询杆塔设备参数
export function getTowerParams(data) {
  return request({
    url: "/eam-service-device/equipment/getTowerParams",
    method: "post",
    data,
  });
}

//模糊查询基本参数
export function searchParamsByName(data) {
  return request({
    url: "/eam-service-device/equipment/searchParamsByName",
    method: "get",
    params: data,
  });
}

// 根据id查询设备维护数据
export function queryMaintainInfoById (data) {
  return request({
    url: "/eam-service-device/equipment/maintain/selectOne",
    method: "get",
    params: data,
  });
}

// 保存维护数据
export function saveMaintainInfoById (data) {
  return request({
    url: "/eam-service-device/equipment/maintain/save",
    method: "post",
    data,
  });
}

// 更新维护数据
export function updateMaintainInfoById (data) {
  return request({
    url: "/eam-service-device/equipment/maintain/update",
    method: "post",
    data,
  });
}